package main

import (
	"fmt"
	"time"
)

func main() {

	var intChan chan int = make(chan int, 5)
	go func() {
		time.Sleep(time.Second * 5)
		intChan <- 10
	}()

	var stringChan chan string = make(chan string, 5)
	go func() {
		time.Sleep(time.Second * 12)
		stringChan <- "golang"
	}()
	// 阻塞
	// fmt.Println(<-intChan)

	select {
		case v := <-intChan: fmt.Println("intChan: ", v)
		case v := <-stringChan: fmt.Println("stringChan: ", v)
		default: fmt.Println("防止select被阻塞")
	}

}